﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MSPE.Public.FOSS.AutoStatusPlus.TimerJob
{
    internal class Resource
    {
        #region Properties
        /// <summary>
        /// Resource namne
        /// </summary>
        public string Name { get; private set; }

        /// <summary>
        /// Is windows account?
        /// </summary>
        public bool IsWindowsUser { get; private set; }

        /// <summary>
        /// Windows account
        /// </summary>
        public string WindowsAccount { get; private set; }
        #endregion

        #region Constructors
        /// <summary>
        /// Resource constructor
        /// </summary>
        /// <param name="resourceDS"></param>
        public Resource(ResourceSvc.ResourceDataSet resourceDS)
        {
            WindowsAccount = string.Empty;
            IsWindowsUser = false;
            Name = string.Empty;
            if (resourceDS.Resources.Count == 1)
            {
                Name = resourceDS.Resources[0].RES_NAME;
                IsWindowsUser = resourceDS.Resources[0].RES_IS_WINDOWS_USER;
                WindowsAccount = resourceDS.Resources[0].IsWRES_ACCOUNTNull() ? string.Empty : resourceDS.Resources[0].WRES_ACCOUNT;
            } // End if
        } // Resource()
        #endregion
    }
}
